﻿@{
    List<KeppelLand.Entities.ReportingPeriodHistory> reportingPeriodList = PageData[0];
}
@if ((reportingPeriodList != null) && (reportingPeriodList.Count > 0))
{
    @*<h2>Claims pending submission</h2>*@

    <table class="table table-striped table-bordered" id="pending_submission_claim_list">
        <thead>
            <tr>
                <th class="col-lg-2">Cut-off Period</th>
                <th class="col-lg-2">Cut-off Date</th>
                <th class="col-lg-2">Locked Date</th>
                <th class="col-lg-6">Actions</th>
            </tr>
        </thead>
        <tbody>
            @foreach (KeppelLand.Entities.ReportingPeriodHistory p in reportingPeriodList)
            {
            <tr>
                <td>@p.EndDate.ToString("yyyy-MMM").ToUpper()</td>
                <td>@p.EndDate.ToString("yyyy-MM-dd")</td>
                <td>@p.LockedDate.GetValueOrDefault().ToString("yyyy-MM-dd")</td>
                <td>
                    @if (!string.IsNullOrEmpty(p.ClaimMonth))
                    {
                        string[] claimMonths = p.ClaimMonth.Split(',');
                        
                        <ul class="list-inline" style="margin:0;">
                            @foreach (string claimMonth in claimMonths)
                            {
                            <li>
                                <a href="@VirtualPathUtility.ToAbsolute("~/Export-ClaimFile-History.cshtml?rpid=" + p.Id + "&mm=" + @claimMonth.Trim()+"01")">
                                    @(DateTime.ParseExact(claimMonth.Trim(), "yyyyMM", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy-MMM").ToUpperInvariant() + ".csv")
                                </a>
                                </li>
                            }
                        </ul>
                    }
                </td>
            </tr>
            }
        </tbody>

    </table>

<p>&nbsp;</p>
}
